package com.vegetable.modules.service.baseData.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vegetable.common.utils.PageUtils;
import com.vegetable.common.utils.Query;
import com.vegetable.modules.entity.baseData.ProductPackMaterial;
import com.vegetable.modules.mapper.baseData.ProductPackMaterialMapper;
import com.vegetable.modules.service.baseData.IProductPackMaterialService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 自营包装耗材标准 服务实现类
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-05
 */
@Slf4j
@Service
@AllArgsConstructor
public class ProductPackMaterialServiceImpl extends ServiceImpl<ProductPackMaterialMapper, ProductPackMaterial> implements IProductPackMaterialService {

    /**
     * 自营包装耗材标准
     * @param params
     * @return
     */
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String producerId = (String)params.get("producerId");
        IPage<ProductPackMaterial> page = this.page(
                new Query<ProductPackMaterial>().getPage(params),
                new QueryWrapper<ProductPackMaterial>()
                        .eq(StringUtils.isNotBlank(producerId),"producer_id", producerId)
        );

        return new PageUtils(page);
    }
}
